/*************************************************
 *FileName:      circlefriends.js
 *Description:   朋友圈内容详情.js
 *Others:        陈灿
 *************************************************/
    /*
     * 启动
     */
    mui.init();
    mui('.mui-scroll-wrapper').scroll({
        indicators: false,      //是否显示滚动条 默认为true
        deceleration: 0.003,    //阻尼系数,系数越小滑动越灵敏 默认0.0006
        bounce: true           //是否启用回弹 默认true
    });
    mui.init({
        beforeback: function() {
            var list = plus.webview.currentWebview().opener();
            mui.fire(list, 'circlefriends');
            return true;
        }
    });
    mui.plusReady(function(){ 
        var wv=plus.webview.currentWebview();// 关闭侧滑返回功能
        wv.setStyle({'popGesture':'none'});
        var old_back = mui.back;
        mui.back = function() {
            if(orderopen==true){
                old_back();
            }else{ 
                orderopen=true;
                $('.pls-img-look').css({display:'none'});
                $('#video')[0].pause();
            }
        }
    });
    /*
     * 变量初始化
     */
    var article_id = getUrlParam('id');
    var uid = localStorage.replace_uid;
    var token = localStorage.replace_token;
    var article_uid = '',orderopen=true;
    var odata={ uid: uid,token :token};
    /*
     * 主程序
     */ 
    $(document).ready(function() 
    {
        //样式加载
        pagecss();
        //表情加载
//      getface(0,'');
//      getface(1,odata);
    });
    /**
     * pagecss
     * 样式加载
     * @cc 
     * @DateTime 2018-01-08T06:19:16+0800
     * @param    int        
     * @return   void
     */
    function pagecss(){
         mui.plusReady(getArticleDetail)
         mui.plusReady(getArticlesComments)
//       getArticleDetail()
//       getArticlesComments()
//      if(){//判断是否是自己的id
//          $('.circlefriendsimg .header-menu').on('tap',function(){
//              $('.menu-click2').fadeIn();
//              $('.popover-img').show();
//          })//朋友圈图片预览菜单显示
//      }else{
            $('.circlefriendsimg .header-menu').on('tap',function(){
                if(article_uid == uid){
                    $('.menu-click3').fadeIn();
                }else{
                    $('.menu-click2').fadeIn();
                }
                
                $('.popover-img').show();
            })//朋友圈图片预览菜单显示
//          getMyArticles();
//      }
        
        $('.chat').on('tap','.face-bot a',function(){
            //获得slider插件对象
            $('.menu-face .mui-slider').removeClass('active');
            $(this).addClass('face-bot-color').siblings().removeClass('face-bot-color');
            var oindex = $(this).index();
            if(oindex){
                $('.mui-slider-myface').addClass('active');
            }else{
                $('.mui-slider-sitface').addClass('active');
            }
        })
        
        $('.particulars').on('tap','.face',function(){
            if(!$(this).hasClass('active')){
                $('.chat-val').blur();
                getface(0,'');
                getface(1,odata);
                fontup();
                $('.menu-box').css({display:'block'});
            }else{
                $('.chat-val').fadeIn();
                $('.menu-box').css({display:'none'});
            }
            $(this).toggleClass('active');
        })//表情等等点击上下
        
        $('.chat').on('focusin','.chat-val',function(){
            if($('.face').hasClass('active')){
                $('.menu-box').css({display:'none'});
                $('.face').toggleClass('active');
            }
        }).on('input','.chat-val',function(){
            var param = $(this).text();
            var regRule = /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g;
            if(param.match(regRule)) {
                param = param.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g, "");
                $(this).text(param)
            }
            if($(this).text().length>0||$(this).find('.face-bq').length>0){
                $(this).removeClass('dialogues');
            }else{
                $(this).addClass('dialogues');
            }
        });
        
        $('.chat').on('tap','.like-box .like-img',function(){
            var ofriend_uid = $(this).attr('data-uid');
            common.pageTransition('personal.html?friend_uid='+ofriend_uid)
        });
        
        $('.chat').on('tap','.like-talking .like-img',function(){
            var ofriend_uid = $(this).parents('.like-talk').attr('data-id');
            common.pageTransition('personal.html?friend_uid='+ofriend_uid)
        });
        
        $('.chat').on('tap','.face-bq',function(){
            $('.chat-val').blur();
            $('.dialogue-input').removeClass('dialogues');
            var othisimg = $(this).attr("src");
            $('.chat-val').append('<img class="face-bq" src="'+othisimg+'">')
            $('.rests').css({display:'none'});
            $('.footer .bth').css({display:'block'});
            $('.chat-val-box').scrollTop($('.chat-val').height()) //到底
            return false;
        })
        
        $('.chat').on('tap','.face-add',function(){
            camera(true);
        })
        
        $('.chat').on('tap','.menu-face .face-img',function(){
            var oul ='<img class="face-img" data-src="'+$(this).attr('data-src')+'" src="'+$(this).attr('src')+'">' ;
            upcenter(oul);
        })
        
        
        $('.chat').on('tap','.pls-img-look',function(){
            orderopen=true;
            $(this).css({display:'none'})
            $('#video')[0].pause();
        })
        
        $('.main').on('tap','.user-link-menu',function(){
            $('.popover').fadeIn();
            if(article_uid == uid){
                $('.table-view1').fadeIn();//自己
            }else{
                $('.table-view0').fadeIn();//他人
            }      
            
        })//朋友圈投诉
        
        $('.circlefriends').on('tap','.table-view2 .table-select',function(){
            $(this).toggleClass('active');
        })
        
        $('.main').on('tap',function(){
            $('.dialogue .dialogue-input').blur();
            $('.face').removeClass('active');
            if($('.chat-val').text().length>0||$('.chat-val').find('.face-bq').length>0){
                $('.chat-val').removeClass('dialogues');
            }
        })
        
        $('.table-view-cell-cancel').on('tap',function(){
            $('.table-view-cell-cancel').on('tap',function(){
                if($(this).hasClass('sure')){
                    var report_content = [];
                    var i = 0;
	                $('.table-select').each(function(){
	                    if($(this).hasClass('active')){
	                        report_content[i] = $(this).text();
	                        i++;
	                    }
	                })
                    if(!report_content){
                        mui.toast('请选择您要举报的内容！',{ duration:2000, type:'div' });
                        return false;
                    }
                    $.ajax({
                        type: "post",
                        url: DOMAIN_NAME + "/index.php/api/report/reportAdd",
                        dataType:'jsonp',
                        data: { uid: uid, token: token, report_uid: article_uid, report_content: report_content, type: 1,article_id:article_id },
                        success: function(data) {
                            if(data.error_code == 0){
                                mui.toast('举报成功！',{ duration:2000, type:'div' });
                            }else if(data.error_code == 1001){
                                setTimeout(function(){
                        exitlogin();
                    },1000);
                            }else{
                                mui.toast('举报失败！',{ duration:2000, type:'div' });
                            }
                        }
                    });

                }
                $('.table-select').removeClass('active');
                $('.popover').fadeOut();
                $('.table-view').fadeOut();
            })//下拉菜单栏取消
        })//下拉菜单栏取消
        
        

        $('.circlefriends .table-view-cell-pbpyq').on('tap',function(){
            $('.table-view').fadeOut();
            blackAdd();
        })//朋友圈屏蔽朋友圈

        $('.black').on('tap',function(){
            $('.menu-click1').css('display','none');
            blackAdd();
        })
        function blackAdd(){
            mui.confirm('确定要屏蔽她的朋友圈?','<div class="promit-msg">提示</div>',['确定','取消'],function(e){
                $('.popover').fadeOut();
                if(e.index == 0){
                    if(uid == article_uid){
                        mui.toast('您不能屏蔽自己！',{ duration:2000, type:'div' });
                    }else{
                        $.ajax({
                            type: "post",
                            url: DOMAIN_NAME + "/index.php/api/user/blacklistAdd",
                            dataType:'jsonp',
                            data: { uid: uid, token: token, black_uid: article_uid },
                            success: function(data) {
                                if(data.error_code == 0){
                                    mui.toast('屏蔽成功！',{ duration:2000, type:'div' });
                                    mui.back();
                                }else if(data.error_code == 1001){
                                    setTimeout(function(){
                        exitlogin();
                    },1000);
                                }else{
                                    mui.toast(data.error_msg,{ duration:2000, type:'div' });
                                }
                            }
                        }); 
                    }
                }
            },'div');
        }
        
        
        
        $('.circlefriends .table-view-jb').on('tap',function(){
            $('.table-view0').fadeOut();
            $('.table-view2').fadeIn();
        })//朋友圈举报
        
        $('.circlefriends .table-view-delet').on('tap',function(){
            $('.table-view').css({display:'none'}); 
            mui.confirm('确定要删除这条朋友圈?','<div class="promit-msg">提示</div>',['确定','取消'],function(e){ 
                e.index ? $('.popover').css({display:'none'}):$('.popover').css({display:'none'})
                if(e.index == 0){
                    $.ajax({
                        type: "post",
                        url: DOMAIN_NAME + "/index.php/api/article/articleDel",
                        dataType:'jsonp',
                        data: { uid: uid, token: token, article_id: article_id },
                        success: function(data) {
                            if(data.error_code == 0){
                                mui.back();
                            }else if(data.error_code == 1001){
                                setTimeout(function(){
                        exitlogin();
                    },1000);
                            }else{
                                mui.toast('删除失败！',{ duration:2000, type:'div' });
                            }
                        }
                    }); 
                }
            },'div');
        })//删除朋友圈
        
        $('.circlefriends').on('tap','.like-box .mui-icon',function(){
            if($(this).hasClass('mui-icon-arrowup')){
                $(this).parents('li').find('.like-talking').hide();
                $(this).removeClass('mui-icon-arrowup').addClass('mui-icon-arrowdown');
            }else{
                $(this).parents('li').find('.like-talking').show();
                $(this).removeClass('mui-icon-arrowdown').addClass('mui-icon-arrowup');
            }
        })//朋友圈下拉框
        // 
        $('.main').on('tap','.user-link-a-like',function(){
            var obj = $(this);
            if($(this).hasClass('user-link-a-onlike')){
                articleLikeCancel();
            }else{
                articleLikeAdd();
            }
        })//朋友圈点赞

        $('.btn-like').on('tap',function(){
            if($(this).hasClass('onlike')){
                articleLikeCancel();
            }else{
                articleLikeAdd();
            }
        })

        function articleLikeCancel(){
            $.ajax({
                type: "post",
                url: DOMAIN_NAME + "/index.php/api/article/articleLikeCancel",
                dataType:'jsonp',
                data: { uid: uid, token: token, article_id: article_id },
                success: function(data) {
                    if(data.error_code == 0){
                        $('.user-link-a-like').removeClass('user-link-a-onlike');
                        $('.btn-like').removeClass('onlike');
                        // obj.parents('li').find('.mui-icon').next().remove();
                        $('.like-box').find('.like-img[data-uid="'+localStorage.replace_uid+'"]').remove();
                        var num = $('.like-nums').html()-1;
                        $('.like-nums').html(num);
                    }else if(data.error_code == 1001){
                        setTimeout(function(){
                        exitlogin();
                    },1000);
                    }else{
                        mui.toast('取消点赞失败！',{ duration:2000, type:'div' });
                    }
                }
            }); 
        }

        function articleLikeAdd(){
            $.ajax({
                type: "post",
                url: DOMAIN_NAME + "/index.php/api/article/articleLikeAdd",
                dataType:'jsonp',
                data: { uid: uid, token: token, article_id: article_id },
                success: function(data) {
                    if(data.error_code == 0){
                        $('.user-link-a-like').addClass('user-link-a-onlike');
                        $('.btn-like').addClass('onlike'); 
                        $('.like-box').append('<div class="like-img" data-uid="'+localStorage.replace_uid+'"><img onerror="imgExists(this)" src="'+DOMAIN_NAME+localStorage.replace_face+'"/></div>');
                        var num = $('.like-nums').html()-0+1;
                        $('.like-nums').html(num)
                    }else if(data.error_code == 1001){
                        setTimeout(function(){
                        exitlogin();
                    },1000);
                    }else{
                        mui.toast('点赞失败！',{ duration:2000, type:'div' });
                    }
                }
            }); 
        }


        $('.menu-click3').on('tap','.save-this',function(){
            var src = $('#slider').find('.mui-active').children('a').children('img').attr('src');
            if(!src){
                src = $('#slider .mui-slider-item').eq(0).children('a').children('img').attr('src');
            }
            plus.nativeUI.showWaiting('Downloading');
            var url = src;//下载链接
            var options = {
                method: "GET",//get传输方式
                filename: '_doc/'//文件保存位置
            };
            var dtask = plus.downloader.createDownload(src, {}, function(download, status) {
                if ( status == 200 ) { 
                    plus.nativeUI.closeWaiting();
                    plus.gallery.save(download.filename, function() {
                        mui.toast('Save successfully');
                    });
                } else {
                    alert( "Download failed: " + status ); 
                }
            });
            dtask.start();
        })//保存图片

        $('.delect-this').on('tap',function(){
            $('.menu-click3').css({display:'none'});
            $('.popover-img').css({display:'none'});
            mui.confirm('确定要删除这条朋友圈吗？','提示',['确定','取消'],function(e){
                if(e.index == 0){
                    $.ajax({
                        type: "post",
                        url: DOMAIN_NAME + "/index.php/api/article/articleDel",
                        dataType:'jsonp',
                        data: { uid: uid, token: token, article_id: article_id },
                        success: function(data) {
                            if(data.error_code == 0){
                                $('.circlefriendsimg').fadeOut();
                                mui.back();
                            }else if(data.error_code == 1001){
                                setTimeout(function(){
                        exitlogin();
                    },1000);
                            }else{
                                mui.toast('删除失败！',{ duration:2000, type:'div' });
                            }
                        }
                    }); 
                }
            },'div');
        })//删除动态
        
        $('body').on('focusin','.dialogue-input',function(){
            $('.dialogue-input').removeClass('dialogues')
        })
        
        $('.main').on('tap','.user-link-a-comment',function(){
            msg='';
            touid ='';
            if($('.chat-val').text().length==0&&$('.chat-val').find('img').length==0){
                $('.dialogue-input').addClass('dialogues');
            }
            $('.dialogue-input').attr('data-content', '请输入文字...');
            $('.dialogue').css({'display': 'block'});
            $('.mui-scroll').on('touchend',function(){
                $('.dialogue').css({'display': 'none'});
                $('.dialogue .dialogue-input').blur();
            })
            return false;
        })//朋友圈评论
        
        $('.main').on('tap','.talktext',function(){
            msg=$(this).find('.talkname i').text();
            touid =$(this).parents('.like-talk').attr('data-id') ;
            if(touid==uid){
                mui.alert('不能评论自己！','提示','确定',null,'div')
                return false;
            }
            if($('.chat-val').text().length==0&&$('.chat-val').find('img').length==0){
                $('.dialogue-input').addClass('dialogues');
            }
            $('.dialogue').css({'display': 'block'});
            $('.dialogue-input').attr('data-content', '回复'+msg);
            $('.mui-scroll').on('touchend',function(){
                $('.dialogue').css({'display': 'none'});
                $('.dialogue .dialogue-input').blur();
            })
            return false;
        })//朋友圈评论
        
        
        $('.circlefriendsimg .mui-slider').on('tap','.mui-slider-item',function(){
            $('.circlefriendsimg header.header-color').slideToggle();
            $('.circlefriendsimg footer.friendsimg-footer .ft-bottom').slideToggle();
        })//朋友圈图片预览点击图片头部底部消失
        //待优化
        $('.mui-action-return').on('tap',function(){
            $('.circlefriendsimg').fadeOut();
        })//图片返回
        
        $('.popover-img').on('touchend',function(){
            $('.menu-click').fadeOut();
            $(this).hide();
        })//朋友圈图片预览点击图片头部底部消失
        
        $('.myfriends .popover').on('tap',function(){
            $('.menu-click').hide();
            $(this).hide();
        })//朋友圈点击头部底部消失
        
        $('.dialogue-btn').on('tap',function(){
            var otext =$(".dialogue-input").html();
            upcenter(otext);
        })
        
        $('.main').on('tap','.typebox img',function(){
            orderopen=false;
            $('.pls-img-look').fadeIn();
            $('.dialogue ').css({display:'none'})
                mui('#plsslider').slider({scrollTime: 0}).gotoItem($(this).index());//跳转到第index张图片，index从0开始；
        })//朋友圈图片击跳转详情
        
        $('.main').on('tap','.typebox .user-img-video',function(){
            orderopen=false;
            $('.pls-img-look').fadeIn();
            $('.dialogue ').css({display:'none'})
            $('#video')[0].play();
        })//朋友圈图片击跳转详情
        
    }
    
    function upcenter(oul){
        var cotent = oul.replace(/\"/g,".?.");
        common.loadingIn();
        $.ajax({
            type: "post",
            url: DOMAIN_NAME + "/index.php/api/article_comment/commentadd",
            dataType:'jsonp',
            data: { uid: uid, token: token, article_id: article_id, comment: cotent,to_uid:touid },
            success: function(data) {
                common.loadingOut();
                if(data.error_code == 0){
                    if(msg==''){
                        var li = '<div class="like-talk" data-id="'+uid+'">'
                            +'<div class="like-img"><img onerror="imgExists(this)" src="'+DOMAIN_NAME+localStorage.replace_face+'"/></div>'
                            +'<div class="talktext"><span class="talkname"><i>'+localStorage.replace_nickname+'</i>： </span>'+oul+'</div></div>';
                    }else{
                        var li = '<div class="like-talk" data-id="'+uid+'">'
                            +'<div class="like-img"><img onerror="imgExists(this)" src="'+DOMAIN_NAME+localStorage.replace_face+'"/></div>'
                            +'<div class="talktext"><span class="talkname"><i>'+localStorage.replace_nickname+'</i><em class="color">回复</em>'+msg+'： </span>'+oul+'</div></div>';
                    }
                    $('.like-talking').append(li);
                    $('.comment-nums').html($('.comment-nums').html()-0+1);
                    $(".dialogue-input").html('');
                    $('.menu-box').css({display:'none'});
                    $('.chat-val').addClass('dialogues');
                    $('.face').toggleClass('active');
                    mui.toast('评论成功！',{ duration:2000, type:'div' });
                }else if(data.error_code == 1001){
                    setTimeout(function(){
                        exitlogin();
                    },1000);
                }else{
                    mui.toast(data.error_msg,{ duration:2000, type:'div' });
                }
            }
        }); 
    }

    function fontup(){
        $('.mui-scroll-wrapper').scrollTop($('.main').height());//手机滚动
    }
    //信息加载
    function getArticleDetail(){
        $.ajax({
            type: "post",
            url: DOMAIN_NAME + "/index.php/api/article/getArticleDetail",
            dataType:'jsonp',
            data: { uid: uid, token: token, article_id: article_id },
            success: function(data) {
                if(data.error_code == 0){
                    console.log(data)
                    var likes = '<a class="mui-icon mui-icon-arrowup"></a>';
                    if(data.data.likes){
                        for(var i=0; i<data.data.likes.length; i++){
                            likes += '<div class="like-img" data-uid="'+data.data.likes[i].uid+'"><img onerror="imgExists(this)" src="'+DOMAIN_NAME+data.data.likes[i].face+'"/></div>'
                        }
                    }
                    if(data.data.type==2){
                        var imgs = '';
                        var slider = '';
                        article_uid = data.data.uid;
                        $('.user-name').html(data.data.nickname);
                        $('.user-img').attr('src',DOMAIN_NAME+data.data.cover_img);
                        $('.user-text-box').html(data.data.content);
                        $('.time').html(common.formatPassTime(data.data.publish_time*1000));
                        
                        $('#img').html('<img src="'+DOMAIN_NAME+data.data.cover_img+'"/>')
                        $('.mui-slider-group').html('<div class="mui-slider-item"><a ><img src="'+DOMAIN_NAME+data.data.cover_img+'"/></a></div>');
                    }else{
                        var typebox='';
                        var imgs = '';
                        var slider = '';
                        article_uid = data.data.uid;
                        $('.main').on('tap','.user-img',function(){
                            var otid = $(this).parents('li').attr('data-uid');
                                common.pageTransition('personal.html?friend_uid='+article_uid)
                        })
                        $('.user-name').html(data.data.nickname);
                        $('.user-img').attr('src',DOMAIN_NAME+data.data.face);
                        $('.user-text-box').html(data.data.content);
                        $('.time').html(common.formatPassTime(data.data.publish_time*1000));
                        
                        if(data.data.is_like){
                            $('.user-link-a-like').addClass('user-link-a-onlike');
                            $('.btn-like').addClass('onlike'); 
                        }
                        $('.mui-slider-group').html(slider);
                        $('.comment-nums').html(data.data.comment_nums);
                        if(data.data.files.length>0){
                            if(data.data.files.length==1){
                                if(data.data.files[0].type==1){
                                    imgs += '<img src="'+DOMAIN_NAME+data.data.files[0].thumb+'"/>'
                                    slider += '<div class="mui-slider-item"><a ><img src="'+DOMAIN_NAME+data.data.files[0].url+'"/></a></div>';
                                    typebox=$('#img');
                                }else{
                                    imgs += '<div class="user-img-video"></div><img onerror="chatimgExists(this)" src="'+data.data.files[0].thumb+'"/>'
                                    slider += '<div class="mui-slider-item"><a ><div id="vdo-loding"></div><video id="video" src="'+data.data.files[0].url+'"></video></a></div>';
                                    typebox=$('#vdo');
                                }
                            }else{
                                for(var i=0; i<data.data.files.length; i++){
                                    imgs += '<img src="'+DOMAIN_NAME+data.data.files[i].thumb+'"/>'
                                    slider += '<div class="mui-slider-item"><a ><img src="'+DOMAIN_NAME+data.data.files[i].url+'"/></a></div>';
                                    typebox=$('#imgs');
                                }
                            }
                            typebox.html(imgs);
                        }
                        if(data.data.is_like){
                            $('.user-link-a-like').addClass('user-link-a-onlike');
                            $('.btn-like').addClass('onlike'); 
                        }
                        $('.mui-slider-group').html(slider);
                        $('.comment-nums').html(data.data.comment_nums);
                        if(data.data.files.length>0 && data.data.files[0].type==2){
                            $('#video')[0].addEventListener('canplay',function(){//监听是否加载完毕
                                $('#vdo-loding').remove();
                            })
                        }
                    }
                    $('.like-box').html(likes);
                }else if(data.error_code == 1001){
                    setTimeout(function(){
                        exitlogin();
                    },1000);
                }else{
                    mui.toast(data.error_msg,{ duration:2000, type:'div' });
                }
            }
        }); 
    }
    //评论列表
    function getArticlesComments(){
        $.ajax({
            type: "post",
            url: DOMAIN_NAME + "/index.php/api/article_comment/getCommentList",
            dataType:'jsonp',
            data: { uid: uid, token: token, article_id: article_id },
            success: function(data) {
                if(data.error_code == 0){
                    var list = '';
                    for(var i=0; i<data.data.length; i++){
                        var content = data.data[i].comment.replace(/\.\?\./g,"'");
                        if(data.data[i].to_uid=='0'){
                            list += '<div class="like-talk" data-id="'+data.data[i].uid+'">'
                                +'<div class="like-img"><img onerror="imgExists(this)" src="'+DOMAIN_NAME+data.data[i].face+'"/></div>'
                                +'<div class="talktext"><span class="talkname"><i>'+data.data[i].nickname+'</i>： </span>'+content+'</div></div>';
                        }else{
                            list += '<div class="like-talk" data-id="'+data.data[i].uid+'">'
                                +'<div class="like-img"><img onerror="imgExists(this)" src="'+DOMAIN_NAME+data.data[i].face+'"/></div>'
                                +'<div class="talktext"><span class="talkname"><i>'+data.data[i].nickname+'</i><em class="color">回复</em>'+data.data[i].to_nickname+'： </span>'+content+'</div></div>';
                        }
                    }
                    $('.like-talking').append(list);
                }else if(data.error_code == 1001){
                    setTimeout(function(){
                        exitlogin();
                    },1000);
                }else{
//                  mui.toast(data.error_msg,{ duration:2000, type:'div' });
                }
            }
        });
    }
    
    function getface(sys,odata){
        $.ajax({
            type: "post",
            url: DOMAIN_NAME +'/index.php/api/chat/getSystemExpressionsList' ,
            dataType:'jsonp',
            data: odata,
            success: function(data) {
                var ohtml='';
                var oli ='';
                if(data.error_code == 0){
                    ohtml+='<div class="mui-slider-group"><div class="mui-slider-item">';
                    for(var i=0 ; i<data.data.length; i++){
                        if(sys==0){
                            if((i%21==0)&&(i!=0)){
                                ohtml+='</div><div class="mui-slider-item">';
                                oli+='<div class="mui-indicator"></div>';
                            }
                            ohtml+='<a data-id="'+data.data[i].id+'"><img class="face-bq" src="'+DOMAIN_NAME+data.data[i].url+'"></a>';
                        }else{
                            if(((i+1)%10==0)&&(i!=0)){
                                ohtml+='</div><div class="mui-slider-item">';
                                oli+='<div class="mui-indicator"></div>';
                            }else if((i==0)&&(sys==1)){
                                ohtml+='<a class="face-add"><img src="images/chat_add.png"></a>';
                            }
                            ohtml+='<a data-id="'+data.data[i].id+'" ><img class="face-img" data-src="'+data.data[i].url+'"  data-thumb="'+data.data[i].url+'" src="'+DOMAIN_NAME+data.data[i].url+'"></a>';
                        }
                        
                    }
                    ohtml+='</div></div><div class="mui-slider-indicator"><div class="mui-indicator mui-active"></div>'+oli+'</div></div>';
                }else if(data.error_code == 1001){
                    setTimeout(function(){
                        exitlogin();
                    },1000);
                }else{
                    $('.menu-face .mui-slider').eq(sys).find('.mui-slider-group').html('');
                }
                sys==0? $('.mui-slider-sitface').html(ohtml): $('.mui-slider-myface').html(ohtml);
                mui(".mui-slider").slider({interval: 0});
            }
        });
    }
    
    